<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<meta name="format-detection" content="telephone=no"/>
<meta name="wap-font-scale" content="no">
<meta name="renderer" content="webkit">
<title>AutoCode</title>
<link rel="shortcut icon" href="/favicon.ico" />
<script src="/links/jquery/jquery-3.5.1.min.js"></script>
<script src="/links/polyfill.min.js"></script>
<script src="/links/axios/axios.min.js"></script>
<script src="/links/vue/vue.min.js"></script>
<script src="/links/element-ui/index.js"></script>
<script src="/links/dayjs.min.js"></script>
<script src="/links/echarts/echarts.js"></script>
<script src="/links/JsBarcode.all.js"></script>
<script src="/links/qrcode.min.js"></script>
<script src="/links/layer/layer.js"></script>
<script src="/links/crypto/crypto-js.js"></script>
<script src="/js/dragController.js"></script>
<script src="/js/HttpApi.js"></script>
<script src="/js/AutoCode.js"></script>
<link href="/links/element-ui/theme/index.css" rel="stylesheet"/>
<link href="/css/default.css" rel="stylesheet"/>
<link href="/css/dragController.css" rel="stylesheet"/>
    
    <style>
        
    </style>
</head>
<body>
<div id="app"  class="box " >
<div class="flex ac-form-head ac-form-oper-head-line">
    <div class="ac-form-title">{{email.title}}</div>
    <div class="ac-form-oper"><el-button size="medium"  v-if="email.operVisible.edit" @click="email_editEmailAdd()" :disabled="email.operDisabled.edit"  type="text"     native-type="button">设置信息(E)</el-button>
</div>
</div>
<div class="ac-form-content">
            <el-form class="ac-form-detail"  :show-message="false"  label-width="120px" label-position="right"
     size="mini" ref="email" :model="email.data" :rules="email.rules"  
     :disabled="email.disabled" @submit.native.prevent>
    <fieldset><legend>发邮件设置</legend><el-row><el-col :span=24 v-if="email.itemVisible.host">
    <el-form-item prop="host" label="SMTP服务器">
        {{email.data.host}}

    </el-form-item>
</el-col>
<el-col :span=24 v-if="email.itemVisible.port">
    <el-form-item prop="port" label="服务器端口">
        {{email.data.port}}

    </el-form-item>
</el-col>
<el-col :span=24 v-if="email.itemVisible.authType">
    <el-form-item prop="authType" label="发送方式">
        <template v-if="email.data.authType=='default'">默认</template><template v-else-if="email.data.authType=='SSL'">SSL</template><template v-else>{{email.data.authType}}</template>
    </el-form-item>
</el-col>
</el-row></fieldset><fieldset><legend>系统发邮件账号</legend><el-row><el-col :span=24 v-if="email.itemVisible.address">
    <el-form-item prop="address" label="名称">
        {{email.data.address}}

    </el-form-item>
</el-col>
<el-col :span=24 v-if="email.itemVisible.username">
    <el-form-item prop="username" label="发邮件邮箱账号">
        {{email.data.username}}

    </el-form-item>
</el-col>
<el-col :span=24 v-if="email.itemVisible.password">
    <el-form-item prop="password" label="发邮件邮箱密码">
        {{email.data.password}}

    </el-form-item>
</el-col>
</el-row></fieldset>
 </el-form>

</div>
<el-dialog :visible.sync="emailAdd.visible" :title="emailAdd.title"
            width="50%"
                
            :close-on-click-modal="false"
            :close-on-press-escape="false">
            <div style="width:100%;">
                <el-form class=""  :show-message="false"  label-width="120px" label-position="right"
     size="mini" ref="emailAdd" :model="emailAdd.data" :rules="emailAdd.rules"  
     :disabled="emailAdd.disabled" @submit.native.prevent>
    <fieldset><legend>发邮件设置</legend><el-row><el-col :span=24 v-if="emailAdd.itemVisible.host">
    <el-form-item prop="host" label="SMTP服务器">
        
<el-input type="text" size="mini"  v-model="emailAdd.data.host" placeholder="SMTP服务器" :disabled="emailAdd.itemDisabled.host"  @keyup.enter.native="emailAdd_dialogOk"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="emailAdd.itemVisible.port">
    <el-form-item prop="port" label="服务器端口">
        
<el-input type="text" size="mini"  v-model="emailAdd.data.port" placeholder="服务器端口" :disabled="emailAdd.itemDisabled.port"  @keyup.enter.native="emailAdd_dialogOk"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="emailAdd.itemVisible.authType">
    <el-form-item prop="authType" label="发送方式">
        <el-select v-model="emailAdd.data.authType"  placeholder="发送方式" size="mini" :disabled="emailAdd.itemDisabled.authType" clearable      @keyup.enter.native="emailAdd_dialogOk">
   <el-option label="默认" value="default"></el-option><el-option label="SSL" value="SSL"></el-option>
</el-select>

        <span class="ac-form-item-remark">用于发送系统邮件的名称</span>
    </el-form-item>
</el-col>
</el-row></fieldset><fieldset><legend>系统发邮件账号</legend><el-row><el-col :span=24 v-if="emailAdd.itemVisible.address">
    <el-form-item prop="address" label="名称">
        
<el-input type="text" size="mini"  v-model="emailAdd.data.address" placeholder="名称" :disabled="emailAdd.itemDisabled.address"  @keyup.enter.native="emailAdd_dialogOk"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="emailAdd.itemVisible.username">
    <el-form-item prop="username" label="发邮件邮箱账号">
        
<el-input type="text" size="mini"  v-model="emailAdd.data.username" placeholder="发邮件邮箱账号" :disabled="emailAdd.itemDisabled.username"  @keyup.enter.native="emailAdd_dialogOk"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="emailAdd.itemVisible.password">
    <el-form-item prop="password" label="发邮件邮箱密码">
        
<el-input type="text" size="mini"  v-model="emailAdd.data.password" placeholder="发邮件邮箱密码" :disabled="emailAdd.itemDisabled.password"  @keyup.enter.native="emailAdd_dialogOk"  ></el-input>

        
    </el-form-item>
</el-col>
</el-row></fieldset>
 </el-form>

            </div>
            <div class="dialog-footer" slot="footer">    <el-button size="mini" @click="emailAdd_dialogOk()"  type="primary"      native-type="button">确 定</el-button>
    <el-button size="medium" @click="emailAdd_dialogCancel()"  type="text"      native-type="button">取 消</el-button>
</div>
</el-dialog>


</div>

</body>
<script th:inline="javascript">
    let vm = new Vue({
            el: '#app',
            data() {
                return {"email":{"title":"邮件收发设置","data":{},"operData":{},"operVisible":{"edit":true},"operDisabled":{},"disabled":false,"editorForm":true,"itemVisible":{"host":true,"port":true,"authType":true,"address":true,"username":true,"password":true},"itemDisabled":{},"transfer":{},"rules":{}},"page":{},"tabDisabled":{},"tabVisible":{},"customOptions":{},"dictOptions":{},"emailAdd":{"visible":false,"title":"邮件收发设置","data":{},"operData":{},"operVisible":{},"operDisabled":{},"disabled":false,"editorForm":true,"itemVisible":{"host":true,"authType":true,"port":true,"address":true,"username":true,"password":true},"itemDisabled":{},"transfer":{},"rules":{}}}
            },
            watch: {
},
            methods: {
emailAdd_change:function(fieldName){
    HttpApi.updateProvider("sysEmail",fieldName,this.emailAdd.data,function(){

    });
},
email_change:function(fieldName){
    HttpApi.updateProvider("sysEmail",fieldName,this.email.data,function(){

    });
},
emailAdd_dialogCancel:function(){
     this.emailAdd.visible = false;
},
emailAdd_dialogOpen:function(param, callback) {
    this.$data.emailAdd.data = this.$options.data().emailAdd.data;
    this.$data.emailAdd.operData = this.$options.data().emailAdd.operData;
    for (let val in param) {
        this.$set(this.emailAdd.data, val, param[val])
    }
    this.$set(this.emailAdd.data, "password", "")
    
    this.emailAdd.callback = callback;
    this.emailAdd.visible = true;
},
emailAdd_load:function(){
    let that = this;
    HttpApi.queryObject("sysEmail",this.emailAdd.operData,function(res){
        that.emailAdd.data = res;
    });
},
email_editEmailAdd: function() {
     let that = this;
     this.emailAdd.editorForm = true;
     this.emailAdd_dialogOpen(this.email.data, function(dialogData) {
         HttpApi.post("/platform/platformSetting/saveEmail", dialogData, function(res) {
             that.email.data = res;
             that.emailAdd.visible = false;
         });
     })
 },
emailAdd_dialogOk:function(){
    let that = this;
    this.$refs.emailAdd.validate(function(valid){
        if(valid){
            that.emailAdd.callback(that.emailAdd.data);
        }else{
            return false;
        }
    });
},
email_load:function() {
    let that = this;
    HttpApi.post("/platform/platformSetting/email", this.email.operData, function(res) {
        that.email.data = res;
    });
}
},
            mounted: function(){
    dragControllerLR();
    dragControllerUD();
},
            created: function(){
    let that=this;
    //获取字典信息
    HttpApi.dictOptions([],function(res){
        that.dictOptions=res;
    });

    //加载自定义数据字典
    

    //加载初始化load
    this.email_load();


    //加载初始化方法
    
}
    });
    

    
</script>
</html>
